# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lasem
pkgver=0.5.1
_apiver=0.6
pkgrel=1
pkgdesc="A library for rendering SVG and Mathml, implementing a DOM like API"
url="https://gitlab.gnome.org/Archive/lasem"
arch="all"
license="LGPL-2.0 GPL-2.0"
makedepends="
	gdk-pixbuf-dev
	gobject-introspection-dev
	intltool
	libxml2-dev
	pango-dev
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-render"
source="https://download.gnome.org/sources/lasem/${pkgver%.*}/lasem-$pkgver.tar.xz
	install-mathml-headers.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-silent-rules
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	# Some software expect pkg-config name without a version.
	test -e "$pkgdir"/usr/lib/pkgconfig/$pkgname-$_apiver.pc
	ln -s $pkgname-$_apiver.pc "$pkgdir"/usr/lib/pkgconfig/$pkgname.pc

	rm -r "$pkgdir"/usr/share/gtk-doc "$pkgdir"/usr/doc
}

render() {
	pkgdesc="Simple MathML converter"

	amove usr/bin/lasem-render*

	test -e "$subpkgdir"/usr/bin/lasem-render-$_apiver
	ln -s lasem-render-$_apiver "$subpkgdir"/usr/bin/lasem-render
}

sha512sums="81186e85a5d5eaebb30f215660181207f4c6a49be7f50c9668dfca72392457ef98c629196c343b8b3db6362bf0d13d4fbd4107f23364adcff8d24f433564fcac  lasem-0.5.1.tar.xz
bdfa5cd2b108d40ec77cee70f5bf2664a003b75249078fe57a8ddffb51a01f0ac8194fbec1ebc000a0aa4a65b08647874ed317bfa4523e24db59f49ca66d34eb  install-mathml-headers.patch"
